 /* qWinWatcher.js (qJSLib)
 
    @Summary    : Simple JS Plugin to make window auto close on when orphaned
    @Author     : Timothy C. Quinn
    @License    : http://www.opensource.org/licenses/mit-license.php
    
    @Dependencies:
     - qCore.js (qJSLib)
   
    @Notes:
     - Table Widget Object based on EventDomain
   
    @Todo:
     - 
*/  

 
function watchOpenerForClose(){
    if(is.wk){console.log("WARNING - qWinWatcher::watchOpenerForClose() is not supported yet by Webkit!"); return;}
    try{if(!_wo||!eval(_SyncVarName)||_w._myWindowSyncID!=eval(_SyncVarName)){throw Error()}}catch(e){window.close();return}
    setTimeout("watchOpenerForClose()",250)
}
if(_wo){
    try {
        _myWindowSyncID=Math.random()*10000
        _SyncVarName="_wo."+"_SubWindow"+parseInt(Math.random()*1000)+"SyncID"
        eval(_SyncVarName+"=_w._myWindowSyncID")
    }catch(e){_wo=null}
    watchOpenerForClose()
}